import { createSlice } from "@reduxjs/toolkit";


interface INavState {
    currentNavIndex: number;
    currentSubNavIndex: number;
}

const initialState: INavState = {
    currentNavIndex: 0,
    currentSubNavIndex: 0
}

export const navSlice = createSlice({
    name: 'nav',
    initialState,
    reducers: {
        setCurrentNavIndex: (state, {payload}: {payload: number}) => {
            state.currentNavIndex = payload;
        },
        setCurrentSubNavIndex: (state, {payload}: {payload: number}) => {
            state.currentSubNavIndex = payload;
        }
    }
})

export const { setCurrentNavIndex, setCurrentSubNavIndex } = navSlice.actions;

export default navSlice.reducer;

